22 template <class T
> string
toStr(const T
&x
){ stringstream s
; s
<< x
; return s
.str(); }
23 template <class T
> int toInt(const T
&x
){ stringstream s
; s
<< x
; int r
; s
>> r
; return r
; }
25 #define For(i, a, b) for (int i=(a); i<(b); ++i)
26 #define foreach(x, v) for (typeof (v).begin() x = (v).begin(); x != (v).end(); ++x)
27 #define D(x) cout << #x " is " << x << endl
32 while (cin
>> n
>> m
&& (n
|| m
)){
33 assert(1 <= n
&& n
<= 20000);
34 assert(1 <= m
&& m
<= 20000);
38 for (int i
=0; i
<n
; ++i
){
40 assert(s
.size() > 1 && s
[0] != '*');
45 assert(0 < k
&& k
< 1000);
49 for (int i
=0; i
<k
; ++i
){